<?php 
    class Socios_model extends CI_Model {

        private $_tabla = 'socios';
		public $dni = 0;
		public $password = '';
		public $direccion = '';
		public $mail = '';
		public $nombre = '';
		public $apellido = '';
		public $telefono = '';
		public $sancionado = false;
		public $admin = false;
		public $estado = true;
		public $renovado = true;
		
        public function getAll()
        {
            return $this->db->get($this->_tabla)->result_array();
        }
		
		public function insert()
		{
			$this->db->insert($this->_tabla, $this);
		}
		
		public function update()
		{
			$this->db->where('dni', $this->dni);
			$this->db->update($this->_tabla,$this);
		}
		
		public function getByDni($dni)
		{
			$query = $this->db->query("SELECT * FROM " . $this->_tabla . " WHERE dni = '" . $dni . "'");

			foreach ($query->result() as $row)
			{
				return $row;
			}
		}
	}
?>